﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;
using FCMS.Mvc.Security.Principal;
using FCMS.Entities;

namespace FCMS.Mvc
{
    public class BaseController : Controller
    {
        protected HttpContextBase Context
        {
            get
            {
                return this.HttpContext;
            }
        }

        public UserIdentity Identity
        {
            get
            {
                return this.HttpContext.User.Identity as UserIdentity;
            }
        }

        public void SetAuthCookie(User user, bool createPersistentCookie)
        {
            WebUtilities.SetAuthCookie(user, createPersistentCookie);
        }

        public void SignOut()
        {
            WebUtilities.SignOut(this.Context);
        }
    }
}
